package com.lighting.lightingservice.mapper;

import com.lighting.lightingservice.dto.Page;
import com.lighting.lightingservice.dto.Video;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VideoMapper {

    @Select("""
            select id, name, url
            from video
            """)
    List<Video> findAll();

    @Update("""
            update page set mainVideo = #{mainVideo}
            """)
    void updateMainVideo(String mainVideo);

    @Update("""
            update page set blockVideo1 = #{blockVideo1}
            """)
    void updateBlockVideo1(String blockVideo1);

    @Update("""
            update page set blockVideo2 = #{blockVideo2}
            """)
    void updateBlockVideo2(String blockVideo2);

    @Update("""
            update page set blockVideo3 = #{blockVideo3}
            """)
    void updateBlockVideo3(String blockVideo3);

    @Update("""
            update page set blockVideo4 = #{blockVideo4}
            """)
    void updateBlockVideo4(String blockVideo4);


    //***********************测试区*****************************
    @Insert("""
            insert into video(name, url)
            values (#{name}, #{url} )
            """)
    void insertVideo(@Param("name") String n, @Param("url") String u);

    @Delete("""
            delete from video where name=#{name}
            """)
    void deleteVideo(String name);
}
